import type { R, P } from '@/type/base'
import shopList from '@/mock/shoplist.json'
import { request } from '@/utils/request'

export const Test = async (data: object): R<object> => {
  return await request({
    path: '/admin/shop/merchant/menu/add',
    method: 'POST',
    data,
  })
}

/**
 * 获取店铺菜单列表
 */
import type { ShopMerchantMenu } from '@/type/merchant/shopMenu'
export const getMerchantMenuList = async (
  merchantId: number | string
): R<Array<ShopMerchantMenu>> => {
  return await request({
    path: '/buyer/merchant/menu/list',
    method: 'GET',
    data: {
      merchantId: merchantId,
    },
    options: {
      hideLoading: true,
    },
  })
}

/**
 * 获取店铺信息
 * @param merchantId 店铺id
 * @returns
 */
import type { MerchantInfo } from '@/type/merchant/merchant'
export const getMerchantInfo = async (id: number | string): R<MerchantInfo> => {
  return await request({
    path: '/buyer/merchant/info',
    method: 'GET',
    data: {
      id,
    },
  })
}
